package base.thread_demo.demo01;

public class Ticket {

	public static void main(String[] args) {
		Ticket t1 = new Ticket();
		Ticket t2 = new Ticket();
		Ticket t3 = new Ticket();
		Ticket t4 = new Ticket();

		/*
		 * 	1.未使用线程，程序只能在main线程中顺序执行
		 * 	2.有4个Ticket对象，相当于总共销售了400张票，而不是总共售100张票，程序设置不合理。
		 */
		t1.run();
		t2.run();
		t3.run();
		t4.run();
	}


	private int num=100;

	public void run() {
		/*
		 * 	模拟4个窗口总共销售100张车票
		 */
		while(true) {
			if(num>0) {
				System.out.println(num--);
			}else {
				break;
			}
		}
	}

}
